\(\int \cos ^2(e+f x) (a+b \sec ^2(e+f x)) \, dx\) [162]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 31 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {1}{2} (a+2 b) x+\frac {a \cos (e+f x) \sin (e+f x)}{2 f} \]

[Out]

1/2*(a+2*b)*x+1/2*a*cos(f*x+e)*sin(f*x+e)/f

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {4130, 8} \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {1}{2} x (a+2 b)+\frac {a \sin (e+f x) \cos (e+f x)}{2 f} \]

[In]

Int[Cos[e + f*x]^2*(a + b*Sec[e + f*x]^2),x]

[Out]

((a + 2*b)*x)/2 + (a*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 4130

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[A*Cot[e
+ f*x]*((b*Csc[e + f*x])^m/(f*m)), x] + Dist[(C*m + A*(m + 1))/(b^2*m), Int[(b*Csc[e + f*x])^(m + 2), x], x] /
; FreeQ[{b, e, f, A, C}, x] && NeQ[C*m + A*(m + 1), 0] && LeQ[m, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {a \cos (e+f x) \sin (e+f x)}{2 f}+\frac {1}{2} (a+2 b) \int 1 \, dx \\ & = \frac {1}{2} (a+2 b) x+\frac {a \cos (e+f x) \sin (e+f x)}{2 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.06 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=b x+\frac {a (e+f x)}{2 f}+\frac {a \sin (2 (e+f x))}{4 f} \]

[In]

Integrate[Cos[e + f*x]^2*(a + b*Sec[e + f*x]^2),x]

[Out]

b*x + (a*(e + f*x))/(2*f) + (a*Sin[2*(e + f*x)])/(4*f)

Maple [A] (verified)

Time = 0.19 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.77

method result size
risch \(\frac {a x}{2}+x b +\frac {a \sin \left (2 f x +2 e \right )}{4 f}\) \(24\)
parallelrisch \(\frac {a \sin \left (2 f x +2 e \right )+2 \left (a +2 b \right ) x f}{4 f}\) \(27\)
derivativedivides \(\frac {a \left (\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b \left (f x +e \right )}{f}\) \(37\)
default \(\frac {a \left (\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b \left (f x +e \right )}{f}\) \(37\)
norman \(\frac {\left (-\frac {a}{2}-b \right ) x +\left (-\frac {a}{2}-b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}+\left (\frac {a}{2}+b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{4}+\left (\frac {a}{2}+b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{6}-\frac {a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}+\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{f}-\frac {a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{f}}{\left (1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )}\) \(147\)

[In]

int(cos(f*x+e)^2*(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/2*a*x+x*b+1/4*a/f*sin(2*f*x+2*e)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.90 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {{\left (a + 2 \, b\right )} f x + a \cos \left (f x + e\right ) \sin \left (f x + e\right )}{2 \, f} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*((a + 2*b)*f*x + a*cos(f*x + e)*sin(f*x + e))/f

Sympy [A] (verification not implemented)

Time = 2.47 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.65 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=a \left (\begin {cases} \frac {x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {x \cos ^{2}{\left (e + f x \right )}}{2} + \frac {\sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \cos ^{2}{\left (e \right )} & \text {otherwise} \end {cases}\right ) + b x \]

[In]

integrate(cos(f*x+e)**2*(a+b*sec(f*x+e)**2),x)

[Out]

a*Piecewise((x*sin(e + f*x)**2/2 + x*cos(e + f*x)**2/2 + sin(e + f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*cos(e)
**2, True)) + b*x

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.19 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {{\left (f x + e\right )} {\left (a + 2 \, b\right )} + \frac {a \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

1/2*((f*x + e)*(a + 2*b) + a*tan(f*x + e)/(tan(f*x + e)^2 + 1))/f

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.19 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {{\left (f x + e\right )} {\left (a + 2 \, b\right )} + \frac {a \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*((f*x + e)*(a + 2*b) + a*tan(f*x + e)/(tan(f*x + e)^2 + 1))/f

Mupad [B] (verification not implemented)

Time = 19.58 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.81 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {\frac {a\,\sin \left (2\,e+2\,f\,x\right )}{4}+f\,x\,\left (\frac {a}{2}+b\right )}{f} \]

[In]

int(cos(e + f*x)^2*(a + b/cos(e + f*x)^2),x)

[Out]

((a*sin(2*e + 2*f*x))/4 + f*x*(a/2 + b))/f